
import { EnumAction } from "xcore/cmpnt";
import { onReady } from "../event";
import { enums, EnumItem } from "./enums";

export const buttonEvents: EnumItem[] = [
    {
        label: "点击", value: "click", type: "event", group: "button", children: [
            { label: "弹出窗口", value: EnumAction.Dilog, type: "", group: "dialog" },
            { label: "提交表单", value: EnumAction.FormSubmit, type: "", group: "search" },
        ],
    },
];
export const inputEvents: EnumItem[] = [
    { label: "改变", value: "change", type: "event", group: "input" },
    { label: "失去焦点", value: "blur", type: "event", group: "input" },
    { label: "输入", value: "input", type: "event", group: "input" },
    { label: "清空", value: "clear", type: "event", group: "input" },
];
export const formEvents: EnumItem[] = [
    { label: "确认", value: "confirm", type: "event", group: "form" },
    { label: "取消", value: "cancel", type: "event", group: "form" },
];
const events: { [type: string]: EnumItem[] } = {
    button: buttonEvents,
    input: inputEvents,
    form: formEvents,
};

export function getEvents(type: string): EnumItem[] | undefined {
    let cevents = events[type];
    return cevents;
}
onReady( () => {
    enums.append(buttonEvents);
    enums.append(inputEvents);
    enums.append(formEvents);
});
